package com.ruoyi.project.zxcrm.service.impl;

import java.util.List;
import com.ruoyi.framework.web.controller.BaseController;
import com.ruoyi.common.zx.PageData;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.project.zxcrm.mapper.SmsChannelMapper;

/**
 * 短信渠道Service业务层处理
 *
 * @author zx
 * @date 2023-06-13
 */
@Service
public class SmsChannelServiceImpl extends BaseController{
    @Autowired
    private SmsChannelMapper smsChannelMapper;

    /**
     * 查询短信渠道
     *
     * @param id 短信渠道主键
     * @return pd
     */

    public PageData selectSmsChannelById(Integer id){
        return smsChannelMapper.selectSmsChannelById(id);
    }

    /**
     * 查询短信渠道列表
     *
     * @param pd
     * @return 短信渠道
     */

    public List<PageData> selectSmsChannelList(PageData pd){
        pd.put("tenant_id",this.getUserTenantId());
        return smsChannelMapper.selectSmsChannelList(pd);
    }

    /**
     * 新增短信渠道
     *
     * @param pd 短信渠道
     * @return 结果
     */
    public int insertSmsChannel(PageData pd){
        pd.put("tenant_id",this.getUserTenantId());
        pd.put("update_by",this.getUsername());
        pd.put("update_time",DateUtils.getTime());
        pd.put("create_by",this.getUsername());
        pd.put("create_time",DateUtils.getTime());
        return smsChannelMapper.insertSmsChannel(pd);
    }

    /**
     * 修改短信渠道
     *
     * @param pd 短信渠道
     * @return 结果
     */
    public int updateSmsChannel(PageData pd){
        pd.put("update_by",this.getUsername());
        pd.put("update_time",DateUtils.getTime());
        return smsChannelMapper.updateSmsChannel(pd);
    }

    /**
     * 批量删除短信渠道
     *
     * @param ids 需要删除的短信渠道主键
     * @return 结果
     */
    public int deleteSmsChannelByIds(Long[] ids)
    {
        return smsChannelMapper.deleteSmsChannelByIds(ids);
    }

    /**
     * 删除短信渠道信息
     *
     * @param id 短信渠道主键
     * @return 结果
     */
    public int deleteSmsChannelById(Long id){
        return smsChannelMapper.deleteSmsChannelById(id);
    }
}
